package com.richest.api.utils;

import com.richest.api.controller.form.MerchantRegisterForm;
import com.richest.bean.EmployeeBean;
import com.richest.bean.MerchantBaseBean;
import com.richest.bean.MerchantQualificationBean;

/**
 * 商户注册表单转换工具
 * 
 * @author 杨博
 *
 */
public class MerchantRegisterFormConvertUtil {
	/**
	 * 商户注册表单转换为商户基本信息Bean
	 * 
	 * @param form
	 * @return
	 */
	public static MerchantBaseBean toMerchantBaseBean(MerchantRegisterForm form) {
		MerchantBaseBean bean = new MerchantBaseBean();
		bean.setIs_examine(false);
		bean.setName(form.getMerchant_name());
		bean.setSynopsis(form.getSynopsis());
		bean.setImage_id(form.getImage_id());
		bean.setPhone_number(form.getMerchant_phone_number());
		bean.setWechat_bind(form.getWechat_bind());
		bean.setMerchant_status_id(3L);

		return bean;
	}

	/**
	 * 商户注册表单转换为商户资质信息Bean
	 * 
	 * @param form
	 * @return
	 */
	public static MerchantQualificationBean toMerchantQualificationBean(MerchantRegisterForm form) {
		MerchantQualificationBean bean = new MerchantQualificationBean();
		bean.setLicense_image_id(form.getLicense_image_id());
		bean.setValidity_begin(form.getValidity_begin());
		bean.setValidity_end(form.getValidity_end());
		bean.setLegal_person_image_id(form.getLegal_person_image_id());
		bean.setLegal_person_name(form.getLegal_person_name());

		return bean;
	}

	/**
	 * 商户注册表单转换为商户雇员信息Bean
	 * 
	 * @param form
	 * @return
	 */
	public static EmployeeBean toEmployeeBean(MerchantRegisterForm form) {
		EmployeeBean bean = new EmployeeBean();
		bean.setLog_name(form.getLog_name());
		bean.setPassword(form.getPassword());
		bean.setName(form.getName());
		bean.setPhone_number(form.getPhone_number());
		bean.setRemarks(form.getRemarks());
		bean.setIs_release(true);

		return bean;
	}

}
